<template>
  <!--    <div class="home-content">

        &lt;!&ndash;右边栏&ndash;&gt;
        <div class="center-panel">
          &lt;!&ndash;发布动态&ndash;&gt;
          &lt;!&ndash;      <div class="section-block" v-if="user && user.userId">
                  <div class="publish-panel">
                    &lt;!&ndash;输入框&ndash;&gt;
                    <div class="editor">
                      <div class="core-style">
                        <input class="editor core-style" v-model="form.remark" type="textarea"
                                  placeholder="有什么想和大家分享的？"
                                  :maxlength="500" show-word-limit
                                   :style="{width: '100%'}"
                                  @input="inputClick(form.remark)"
                        >
                        </input>
                      </div>
                    </div>
                    &lt;!&ndash;                  <ImageUpload :key="form.replyId" @imageUpload="imageUpload" :formImg="formImg"></ImageUpload>&ndash;&gt;
                    &lt;!&ndash;发布选择&ndash;&gt;
                    <div class="toolbar">

                      &lt;!&ndash;左侧选择&ndash;&gt;
                      <div class="toolbar-box">
                        &lt;!&ndash; <div class="bp-emoji-box-container toolbar-item">
                          <button title="表情" class="box-toggle emoji-btn"></button>
                        </div> &ndash;&gt;

                        <div class="image-box toolbar-item">
                          <button title="上传图片" class="box-toggle pic-box" @click="openUpload"></button>
                          <div class="image-popup" v-if="showImgUpload">
                            <div class="static-popup upload-image-box bp-arrow" style="width: 290px;">
                              <div @click="closeUpload" title="放弃图片上传" class="bp-icon-font icon-group-dynamic close-btn"
                              ></div>
                              <div class="title">
                                            <span>图片上传
                                              <span class="d-i-block hint">{{ formImg.length }} / 9</span>
                                            </span>
                              </div>
                              <div class="content-ctnr">
                                <div class="upload-image-wrapper">
                                  <div class="upload-image">
                                    <div class="f-clear upload-list">
                                      <ImageUpload :key="form.replyId" @imageUpload="imageUpload" :formImg="formImg"
                                      ></ImageUpload>
                                      &lt;!&ndash;                                    <div class="f-left upload-btn b-box">
                                                                            <input type="file" accept="image/png, image/jpeg, image/jpg, image/gif"
                                                                                   multiple="multiple" class="upload pointer"
                                                                            >
                                                                            <i class="bp-icon-font icon-add pointer"></i>
                                                                          </div>&ndash;&gt;
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>

                      </div>

                      &lt;!&ndash;发布按钮&ndash;&gt;
                      <div class="publish-launcher">
                                <span class="indicator" v-if="form.remark && form.remark.length>0">{{
                                    form.remark.length
                                  }}</span>
                        <button @click="((form.remark && form.remark.length>0) || formImg.length>0)?submitForm():''"
                                class="publish-btn d-i-block bp-v-middle"
                                :class="[((form.remark && form.remark.length>0) || formImg.length>0)?'':'disabled']"
                        >发布
                        </button>
                      </div>
                    </div>

                  </div>
                </div>&ndash;&gt;
          <view class="btn-wrap">
            <button class="btn btn-submit" @click="onPush">我要发动态</button>
          </view>


          &lt;!&ndash;内容&ndash;&gt;
          &lt;!&ndash; <div class="card-list"> &ndash;&gt;
          &lt;!&ndash;动态选择&ndash;&gt;
          &lt;!&ndash; <div class="most-viewed-panel">
            <svg viewBox="0 0 492 492" class="icon css-1dtzbno">
              <path
                d="M198.608,246.104L382.664,62.04c5.068-5.056,7.856-11.816,7.856-19.024c0-7.212-2.788-13.968-7.856-19.032l-16.128-16.12C361.476,2.792,354.712,0,347.504,0s-13.964,2.792-19.028,7.864L109.328,227.008c-5.084,5.08-7.868,11.868-7.848,19.084c-0.02,7.248,2.76,14.028,7.848,19.112l218.944,218.932c5.064,5.072,11.82,7.864,19.032,7.864c7.208,0,13.964-2.792,19.032-7.864l16.124-16.12c10.492-10.492,10.492-27.572,0-38.06L198.608,246.104z"
              ></path>
            </svg>
            <div class="list-container">
              <div class="list-content" style="left: 0px;">
                <div class="most-viewed-item" @click="quanbuClick">
                  <div class="section">
                    <div class="icon-all active">
                      <svg viewBox="0 0 24 24" class="icon css-1dtzbno">
                        <path
                          d="M12,1 C12.6032725,1 13.0923215,1.49015271 13.0923215,2.09478673 L13.0919415,7.34448672 C14.1405747,6.48008747 15.4863884,5.96064782 16.9538392,5.96064782 C20.299965,5.96064782 23.0136451,8.66144851 23.0136451,11.994424 C23.0136451,12.5976965 22.5234924,13.0867455 21.9188584,13.0867455 L21.9188584,13.0867455 L16.6490923,13.0860736 C17.5214136,14.1341909 18.0461608,15.4820004 18.0461608,16.9526066 C18.0461608,20.2931041 15.3385912,23 12,23 C11.3967275,23 10.9076785,22.5098473 10.9076785,21.9052133 L10.9076785,21.9052133 L10.9080585,16.6555133 C9.85942532,17.5199125 8.51361156,18.0393522 7.04616077,18.0393522 C3.70003499,18.0393522 0.986354862,15.3385515 0.986354862,12.005576 C0.986354862,11.4023035 1.47650758,10.9132545 2.08114159,10.9132545 L7.35090774,10.9139264 C6.47858642,9.86580905 5.95383923,8.51799956 5.95383923,7.04739336 C5.95383923,3.70689593 8.66140884,1 12,1 Z M13.0923215,13.2512833 L13.0923215,20.65393 C14.6933378,20.1831243 15.8615177,18.7037893 15.8615177,16.9526066 C15.8615177,15.2014239 14.6933378,13.7220889 13.0923215,13.2512833 L13.0923215,13.2512833 Z M10.7583198,13.0978976 L3.33400176,13.0978976 C3.80733493,14.6913696 5.28978206,15.8547091 7.04616077,15.8547091 C8.80253948,15.8547091 10.2849866,14.6913696 10.7583198,13.0978976 Z M16.9538392,8.14529092 C15.1974605,8.14529092 13.7150134,9.30863041 13.2416802,10.9021024 L13.2416802,10.9021024 L20.6659982,10.9021024 C20.1926651,9.30863041 18.7102179,8.14529092 16.9538392,8.14529092 Z M10.9076785,3.34607 C9.30666224,3.81687566 8.13848232,5.29621066 8.13848232,7.04739336 C8.13848232,8.79857607 9.30666224,10.2779111 10.9076785,10.7487167 L10.9076785,3.34607 Z"
                          id="合并形状" fill-rule="nonzero"
                        ></path>
                      </svg>
                    </div>
                  </div>
                  <div class="name active">全部动态</div>
                </div>
                <div class="most-viewed-item" @click="gerenClick(item1)" v-for="(item1,index1) in trendsPHList" :key="index1">
                  <div class="section">
                    <div class="avatar">
                     <div class="red-dot"></div>
                    </div>
                  </div>
                  <div class="name">{{ item1.user.nickName }}</div>
                </div>
              </div>
            </div>
            <svg viewBox="0 0 492 492" class="icon css-1dtzbno">
              <path
                d="M382.678,226.804L163.73,7.86C158.666,2.792,151.906,0,144.698,0s-13.968,2.792-19.032,7.86l-16.124,16.12c-10.492,10.504-10.492,27.576,0,38.064L293.398,245.9l-184.06,184.06c-5.064,5.068-7.86,11.824-7.86,19.028c0,7.212,2.796,13.968,7.86,19.04l16.124,16.116c5.068,5.068,11.824,7.86,19.032,7.86s13.968-2.792,19.032-7.86L382.678,265c5.076-5.084,7.864-11.872,7.848-19.088C390.542,238.668,387.754,231.884,382.678,226.804z"
              ></path>
            </svg>
          </div> &ndash;&gt;

          &lt;!&ndash;动态内容&ndash;&gt;
          <div class="feed-card">
            <div class="content">
              <div class="new-notice-bar c-pointer" style="background: #fff;height: 100%" v-if="total<=0">
                <p class="message" style="color: #656565;font-size: 14px">
                  <img style="width: 100%;height: 100%" src="/static/images/user/zhanwu03.jpeg">
                  空空如也
                </p>
              </div>

              &lt;!&ndash;动态内容 &ndash;&gt;
              <div class="content-body" v-for="(item,index) in trendsList" :key="index">
                &lt;!&ndash; <div class="card" style="margin-top: 8px;"> &ndash;&gt;

                <div class="left-view">
                  <img class="user-icon"
                       :src="item.avatar" :alt="item.user.nickName"
                  >
                  &lt;!&ndash; <img class="user-head2" :src="avatar">
                  :src="changeAvatar(item.user.avatar)" :alt="item.user.nickName"
                   &ndash;&gt;
                  &lt;!&ndash; <avatar
                :hoverClass="'none'"
                :avatar="avatar"
                avatarWidth="140"
              ></avatar> &ndash;&gt;
                </div>

                <div class="right-view" style="padding-bottom: 0px;">
                  <div class="user-name-view"> &lt;!&ndash; 昵称 &ndash;&gt;
                    <a @click="btnClick('nickName',item)" class="user-name"
                    >{{ item.user.nickName }}</a>
                  </div>


                  <div class="user-content-view">
                    &lt;!&ndash; 内容 &ndash;&gt;
                    <div class="text" @click="btnClick('edit',item)">

                      <text class="user-content" v-html="item.remark"></text>

                    </div>
                  </div>
                  <div class='photo-view'>
                    &lt;!&ndash; 图片 &ndash;&gt;
                    <div class="photo" style="padding-top: 10px;" if="item.img && item.img.length>0"
                         v-for="(itemImg,indexImg) in item.img" :key="indexImg">
                      <img style="width: 100px;height: 100px" :src="itemImg.url">
                    </div>
                    &lt;!&ndash; <div class="viewer"
                     style="padding-top: 66.071%;"
                     :style="{backgroundImage: 'url(' +item.url + ')'}">
                </div> &ndash;&gt;

                    &lt;!&ndash; <view class="user-avatar">
                         <avatar
                           :hoverClass="'none'"
                           :avatar="avatar"
                           avatarWidth="140"
                         ></avatar>
                     </view> &ndash;&gt;

                  </div>
                  <div class="TDD-view">&lt;!&ndash; 时间 &ndash;&gt;
                    &lt;!&ndash; <a @click="btnClick('trendsUser',item)"
                       class="detail-link tc-slate"
                    >{{ parseTime(item.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</a> &ndash;&gt;
                    <span @click="btnClick('trendsUser',item)"
                          class="">{{ item.createTime }}</span>
                    &lt;!&ndash;投诉、举报】删除按钮 &ndash;&gt;
                    <div class="button-view" style="height: 35px"
                         @mouseover="subsOpen('trends',item)"
                         @mouseleave="subsStop('trends',item)"
                    >
                      <div class="more-button bp-icon-font icon-more-1">
                        <div v-if="item.user.userId==user.userId"
                             style="-webkit-text-stroke-width: 0px;top: 24px;right: -10px"
                             class="more-panel fs-14 ls-0" :style="{'display':item.showPoints?'block':'none'}"
                        >
                          <p @click="btnClick('del',item)" class="child-button c-pointer">删除</p>
                        </div>
                      </div>

                    </div>


                    &lt;!&ndash;点赞评论按钮 &ndash;&gt;
                    <div class="single-button c-pointer">
                                    <span :class="[item.showReplyList?'selected':'']" class="text-bar"
                                          @click="btnClick('reply',item)"
                                    >
                                      &lt;!&ndash; <span :class="[item.showReplyList]" class="text-bar"

                                    > &ndash;&gt;
                                      <img class="img-offset" src="/static/images/icon/pl.png">
                                      <span class="text-offset">{{ item.reply }}</span>
                                    </span>
                    </div>
                  </div>

                  &lt;!&ndash;展示评论内容 &ndash;&gt;
                  &lt;!&ndash; <div class="comment-list has-limit" v-for="(itemReply,indexReply) in replyList"
                           :key="indexReply"
                      >
                        <div class="list-item reply-wrap ">
                          <div class="con ">
                            <div class="user">
                              <a  class="name" style="color: #FB7299;"
                              >{{ itemReply.fromUser.nickName }}</a>

                            <p class="text" v-html="formatSolution(itemReply.remark)">{{ itemReply.remark }}</p></div>
                            <div class="info">
                                      <span class="time">

                                        {{ item.createTime}}</span>
                              <span class="reply btn-hover">回复</span>
                              <div class="operation more-operation">
                                <div class="spot"
                                     @mouseover="subsOpen('reply',itemReply)"
                                     @mouseleave="subsStop('reply',itemReply)"
                                >
                                  <div class="opera-list" v-if="itemReply.action">
                                    <ul v-if="itemReply.fromUser.userId==user.userId">
                                      <li class="blacklist" @click="btnClick('delReply',itemReply,item)">删除</li>
                                    </ul>
                                  </div>
                                </div>

                              </div>
                            </div>

                          </div>
                        </div>
                      </div> &ndash;&gt;

                  <div class="user-content-view" v-for="(itemReply,indexReply) in replyList"
                       :key="indexReply">
                    &lt;!&ndash; 内容 &ndash;&gt;
                    <input placeholder="评论"><button>发送</button>
                    <div class="text" @click="btnClick('edit',item)">
                      <a class="name" style="color: #FB7299;"
                      >{{ itemReply.fromUser.nickName }}</a>
                      <text class="user-content" v-html="itemReply.remark"></text>

                    </div>
                  </div>


                </div>


                &lt;!&ndash;评论内容 &ndash;&gt;
    &lt;!&ndash;            <div class="pinglun_class" v-if="item.showReplyList">
                  <div class="panel-area" style="position: relative;">
                    <div class="bb-comment ">
                      <div class="reply-notice"></div>

                      <div class="comment-send " v-if="user && user.userId">
                        <div class="user-face">
                          <img class="user-head2" :src="avatar">
                        </div>
                        <div class="textarea-container">
                          <i class="ipt-arrow"></i>
                          <input v-model="replyForm.remark" type="textarea"
                                 placeholder="发一条友善的评论"
                                 :maxlength="500" show-word-limit
                                 :style="{width: '100%'}"
                          >
                          </input>
                          <button
                            @click="(replyForm.remark && replyForm.remark.length>0)?submitFormReply(item):''"
                            :class="[(replyForm.remark && replyForm.remark.length>0)?'':'disabled']"
                            type="button" class="comment-submit"
                          >发表评论
                          </button>
                        </div>
                      </div>

                    </div>
                  </div>
                </div>&ndash;&gt;


                &lt;!&ndash; </div> &ndash;&gt;
              </div>


            </div>
          </div>


        </div>
      </div>-->

  <div>
    <div id="main">
      <button style="margin-right: 15px;z-index:1;margin-top: 10px;border: none;position: fixed;right: 0"
              class="btn btn-submit"
              @click="onPush">
        我要发动态
      </button>

      <div id="list" style="clear: both;padding: 40px 0 30px 0;">
        <ul v-if="total>0" style="margin: 0 5px">
          <li v-for="(item,index) in trendsList" :key="index">
            <div class="po-avt-wrap" @click="dynamicClick(item)">
              <img class="po-avt data-avt" :src="item.avatar">
            </div>
            <div class="po-cmt">
              <div class="po-hd">
                <p class="po-name" @click="editClick(item)">
                  <span class="data-name">{{ item.user.nickName }}</span>
                </p>
                <div class="post" @click="editClick(item)">
                  <p>{{ item.remark }}</p>
                  <p v-if="item.img && item.img.length>0">
                    <img class="list-img" style="height: 80px;"
                         v-if="item.img.length>1"
                         v-for="(itemImg,indexImg) in item.img" :key="indexImg"
                         :src="itemImg.url">
                    <img v-if="item.img.length===1"
                         v-for="(itemImg2,indexImg2) in item.img" :key="indexImg2"
                         :src="itemImg2.url">
                  </p>
                </div>
                <p class="time">{{ item.createTime }}
                  <span style="padding-left: 5px;"
                        v-if="item.user.userId==user.userId"
                        @click="btnClick('del',item)">删除</span>
                </p>
                <p @click="playClick(item)" style="float:right;">
                  <img class="c-icon" src="/static/images/icon/pl.png">
                  <span style="padding-left: 5px">{{ item.reply }}</span>
                </p>
              </div>
              <!--评论-->
              <div v-if="item.replyList && item.replyList.length>0">
                <div class="r"></div>
                <div class="cmt-wrap">
                  <div class="cmt-list">
                    <p v-for="(item2,index2) in item.replyList" :key="index2">
                      <span>{{ item2.fromUser.nickName }}：</span>{{ item2.remark }}
                    </p>
                  </div>
                </div>
              </div>
            </div>
          </li>
        </ul>
        <div v-if="total>0" style="padding: 20px;text-align: center;color: #999;">没有更多了</div>
        <div v-if="total<=0">
          <van-empty
            class="custom-image"
            image="https://img.yzcdn.cn/vant/custom-empty-image.png"
            description="空空如也"
          />
        </div>
      </div>

    </div>
    <van-action-sheet @touchmove.prevent @cancel="onCancel" @close="onClose" :show="show" :title="title">
      <div style="height:400px;min-height: 200px;max-height: 450px">
        <div id="list2" style="clear: both;padding: 10px 0 100px 0;">
          <ul v-if="replyList.length>0" style="margin: 0 5px">
            <li v-for="(item,index) in replyList" :key="index">
              <div class="po-avt-wrap">
                <img class="po-avt data-avt" :src="item.avatar">
              </div>
              <div class="po-cmt">
                <div class="po-hd">
                  <p class="po-name">
                    <span class="data-name">{{ item.fromUser.nickName }}</span>
                  </p>
                  <div class="post">
                    <p>{{ item.remark }}</p>
                    <p v-if="item.img && item.img.length>0">
                      <img class="list-img" style="height: 80px;"
                           v-if="item.img.length>1"
                           v-for="(itemImg,indexImg) in item.img" :key="indexImg"
                           :src="itemImg.url">
                      <img v-if="item.img.length===1"
                           v-for="(itemImg2,indexImg2) in item.img" :key="indexImg2"
                           :src="itemImg2.url">
                    </p>
                  </div>
                  <p class="time">{{ item.createTime }}
                    <span style="padding-left: 5px;"
                          v-if="item.fromUser.userId==user.userId"
                          @click="btnClick('delReply',item,trendsById)">删除</span>
                  </p>
                </div>
              </div>
            </li>
          </ul>
          <div v-if="replyList.length>0" style="padding: 20px;text-align: center;color: #999;">没有更多了</div>
          <div v-if="replyList.length<=0">
            <van-empty
              class="custom-image"
              image="https://img.yzcdn.cn/vant/custom-empty-image.png"
              description="空空如也"
            />
          </div>
        </div>
        <div
          style="z-index:99999;display: flex;position: fixed; bottom: 0;width:100%;padding-top: 5px;padding-bottom: 5px;background: #ccc;">
          <div
            style="flex: 1;margin-left: 10px;margin-bottom: 0px;background: #fff;border-radius: 5px;line-height: 30px;max-height: 90px;overflow-y:scroll;">
            <van-field
              :value="replyForm.remark"
              type="textarea"
              placeholder="写评论..."
              autosize
              :border="false"
              @input="inputClick"
            />
          </div>
          <button :disabled="showDisa"
                  @click="submitFormReply(trendsById)"
                  style="width: 100px;text-align: center;margin: 5px;margin-top: 0px;margin-bottom: 0px;height: 45px;line-height:43px;border-radius: 5px;font-size: 15px;background-color: #ffbd4a;">
            发表评论
          </button>
        </div>
      </div>
    </van-action-sheet>
    <van-dialog id="van-dialog"/>
  </div>

</template>

<script>
import {listTrends, addTrends, delTrends, updateReplyNumberDel, updateReplyNumber} from '@/api/trends'
import {listReply, getReply, addReply, delReply} from '@/api/plainReply'
import {mapGetters} from 'vuex'
import {getToken} from '@/utils/auth'
import {addMessage} from '@/api/message'
import {changeURLIMG} from "@/utils/association"
import Bus from "../../utils/bus";

import Dialog from '@/../static/vant/dialog/dialog'

export default {
  name: 'list',
  data() {
    return {
      // 查询参数
      queryParams: {
        // pageNum: 1,
        // pageSize: 10,
        status: '0'
      },
      showDisa: true,
      replyList: [],
      title: '0条评论',
      trendsList: [],
      total: 0,
      rows: '',
      trendsById: "",
      replyForm: {},
      show: false
    }
  },
  computed: {
    ...mapGetters([
      'user', 'avatar'
    ])
  },
  created() {

    // this.identityCheck()
  },
  mounted() {
    Bus.$on('跳转刷新', (res => {
      this.getList();
    }))

    this.getList()

  },
  methods: {
    editClick(val){
      wx.navigateTo({
        url: '/pages/circle/reply/main?trendsId='+val.trendsId
      });
    },
    dynamicClick(val){
      wx.navigateTo({
        url: '/pages/circle/dynamicuser/main?userId='+val.userId
      });
    },
    onCancel() {
      this.show = false
      this.replyForm = {}
      this.showDisa = true
    },
    onClose() {
      this.show = false
      this.replyForm = {}
      this.showDisa = true
    },

    //跳转发布页面
    onPush() {
      if (!getToken()) {
        this.setToast({title: "请先登录！"})
        this.$store.dispatch('LogOut').then(() => {
          wx.navigateTo({
            url: '/pages/subpage/login/main'
          })
        })
      } else {
        wx.navigateTo({
          url: '/pages/circle/trends/main'
        });
      }
    },
    playClick(val) {
      // console.log("sss", val)
      this.show = true
      this.title = val.reply + '条评论'
      this.getReplyList(val.trendsId)
      this.trendsById = val
    },
    /** 查询动态列表 */
    getList() {
      let that = this
      listTrends(this.queryParams).then(response => {
        this.trendsList = response.rows
        this.trendsList.map(item => {
          item.img = changeURLIMG(item.img)
          item.avatar = this.changeAvatar(item.user.avatar)
          item.remark = this.formatSolution(item.remark)
          item.createTime = this.parseTime(item.createTime, '{m}-{d} {h}:{i}')
        })
        this.total = response.total
        /*let rows = response.rows
        if (rows.length > 0) {
          for (let i = 0; i < rows.length; i++) {
            listReply({status: '0', contentId: rows[i].trendsId}).then(res => {
              rows[i].replyList = res.rows
            })
          }
          that.trendsList = rows
        } else {
          that.trendsList = response.rows
        }
        that.trendsList.map(item => {
          item.img = changeURLIMG(item.img)
          item.avatar = this.changeAvatar(item.user.avatar)
          item.remark = this.formatSolution(item.remark)
          item.createTime = this.parseTime(item.createTime, '{m}-{d} {h}:{i}')
          console.log("222", item.replyList)
        })
        console.log("sss", that.trendsList)*/
      })
    },
    formatSolution(val) {
      if (val) {
        let newString = val.replace(/\n/g, '_@').replace(/\r/g, '_#')
        newString = newString.replace(/_#_@/g, '\n') // IE7-8
        newString = newString.replace(/_@/g, '\n') // IE9、FF、chrome
        newString = newString.replace(/\s/g, '\t') // 空格处理
        return newString
      } else {
        return val
      }
    },

    //获取评论
    getReplyList(val) {
      let params = {
        // pageNum: 1,
        // pageSize: 10,
        contentId: val,
        status: '0'
      }
      listReply(params).then(response => {
        this.replyList = response.rows
        this.replyList.map(item => {
          item.img = changeURLIMG(item.img)
          item.avatar = this.changeAvatar(item.fromUser.avatar)
          item.remark = this.formatSolution(item.remark)
          item.createTime = this.parseTime(item.createTime, '{m}-{d} {h}:{i}')
        })
        // this.total = response.total
      })
    },

    inputClick(val) {
      if (!getToken()) {
        this.setToast({title: "请先登录！"})
        this.$store.dispatch('LogOut').then(() => {
          wx.navigateTo({
            url: '/pages/subpage/login/main'
          })
        })
      } else {
        let value = val.mp.detail
        if (value.trim().length) {
          this.showDisa = false
          this.replyForm.remark = value
        }
      }
    },
    //发布评论
    submitFormReply(val) {
      wx.showLoading({title: "正在发布"});
      this.replyForm.fromId = JSON.parse(JSON.stringify(this.user.userId))
      this.replyForm.contentId = JSON.parse(JSON.stringify(val.trendsId))
      addReply(this.replyForm).then(response => {
        this.setToast({title: '评论成功'});
        this.replyForm = {}
        this.showDisa = true
        this.getReplyList(val.trendsId)
        updateReplyNumber(val.trendsId).then(()=>{
          this.getList()
        })
        if (val.user.userId == this.user.userId) {
          return
        }
        let message = {
          fromId: this.user.userId,
          fromName: this.user.nickName,
          toId: val.user.userId,
          toName: val.user.userName,
          messageTitle: '动态',
          identity: '1',
          type: '1',
          payload: JSON.stringify(val),
          messageContent: '回复了你的动态'
        }
        addMessage(message)
      })
    },

    btnClick(e, val, data) {
      if (e == 'del') {
        Dialog.confirm({
          message: '确定要删除吗？',
        }).then(() => {
          delTrends(val.trendsId).then(res => {
            this.setToast({title: '删除成功'});
            console.log('删除成功')
            this.getList()
          })
        }).catch(() => {
          // on cancel
        });
        /*wx.showModal({
          title: '提示',
          content: "是否要删除",
          success(res) {
            if (res.confirm) {
              delTrends(val.trendsId).then(res => {
                let that = this
                //  this.setToast({title:'删除成功'});
                console.log('删除成功')
                Bus.$emit('跳转刷新', 'onSave');
                // that.getList()
              })
            } else if (res.cancel) {
              console.log('用户取消')
            }
          }
        })*/


      } else if (e == 'delReply') {
        Dialog.confirm({
          message: '确定要删除吗？',
        }).then(() => {
          delReply(val.replyId).then(res => {
            console.log('删除成功')
            this.setToast({title: '删除成功'});
            this.getReplyList(data.trendsId)
            updateReplyNumberDel(data.trendsId).then(()=>{
              this.getList()
            })
          })
        }).catch(() => {
          // on cancel
        });
        /*wx.showModal({
          title: '提示',
          content: "是否要删除",
          success(res) {
            if (res.confirm) {
              delReply(val.replyId).then(res => {
                let that = this
                console.log('删除成功')
                Bus.$emit('跳转刷新', 'onSave');
                // that.getList()
              })
            } else if (res.cancel) {
              console.log('用户取消')
            }
          }
        })*/
      } else if (e == 'reply') {
        if (val.showReplyList) {
          this.$set(val, 'showReplyList', false)
        } else {
          // this.$set(val, 'showReplyList', true)
        }
        this.trendsList.map(item => {
          if (item.trendsId !== val.trendsId) {
            this.$set(item, 'showReplyList', false)
          }
        })
        // this.$set(val, 'showReplyList', true)
        this.getReplyList(val.trendsId)
      } else if (e == 'edit') {
        this.$router.push({
          path: '/trends/edit',
          query: {
            id: val.trendsId
          }
        })
      }
    }
  }
}
</script>

<!--<style scoped>
/*.btn-wrap {*/
/*  position: fixed;*/
/*  bottom: 0;*/
/*}*/

feed-card {
  background: whitesmoke;
}

.feed-card {
  width: 100%;
  /* overflow-x: hidden */
}

/* 列表 */
.content {
  background: white;
  margin-bottom: 1px;
  border-bottom: 1px solid whitesmoke;
  border-top: 1px solid whitesmoke;
}

.content-body {
  display: flex;
}

.left-view {
  width: 75px;
  /* background: rebeccapurple; */
}

.right-view {
  /* background: red; */
}

/* 头像 */
.user-icon {
  /* display: flex; */
  width: 50px;
  height: 50px;
  margin-left: 10px;
  margin-top: 15px;
  margin-right: 10px;
}

/* 昵称 */
.user-name {
  display: flex;
  height: 25px;
  line-height: 25px;
  font-size: 18px;
  color: rgb(88, 103, 138);
  margin-top: 15px;
  margin-left: 5px;
}

/* 内容 */
.user-content {
  display: flex;
  font-size: 18px;
  line-height: 25px;
  margin-left: 5px;
}

/* 图片 */
.photo-view {
  background: rebeccapurple;
  margin-left: 5px;
  margin-bottom: 10px;
}

.photo {
  /* background: rgb(255, 166, 0);   */
  float: left;
  margin-right: 5px;
  margin-top: 5px;
}

/* 时间 */
.TDD-view {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  background: white;
}

.TDD-view span {
  font-size: 13px;
  margin-left: 5px;
}

.TDD-view text-bar {
  /* width: 25px;
height: 20px;
margin-right: 10px; */
}

/* 评论内容-评论头像 */
.user-head2 {
  height: 60px;
  width: 60px;
  border-radius: 90%;

}

.user-face {
  text-align: left;
}

.textarea-container {
  text-align: right;
}

/* 评论图标 */
.img-offset {
  height: 15px;
  width: 15px;

}

.pinglun_class {

}
</style>-->

<style scoped>
.pinglu {
  display: flex;
  position: fixed;
  bottom: 0;
  width: 100%;
  padding-top: 5px;
  padding-bottom: 5px;
  background: #ccc;
}

.pinglu_input {
  flex: 1;
  margin-left: 10px;
  margin-bottom: 0px;
  background: #fff;
  border-radius: 5px;
  line-height: 30px;
  max-height: 90px;
  overflow-y: scroll;
}

.pinglu_btn {
  width: 100px;
  text-align: center;
  margin: 5px;
  margin-top: 0px;
  margin-bottom: 0px;
  height: 40px;
  line-height: 40px;
  color: #fff;
  font-size: 12px;
  border-radius: 5px;
  background: #007aff;
}

/**
 * Created by Administrator on 2016/1/31.
 */
#list, #list2, #list2 li, #list li, .po-hd, .post {
  overflow: hidden
}

.po-cmt, .post .list-img:nth-child(1), .time {
  float: left
}

#list li, #list2 li.cmt-wrap, .r, .time {
  clear: both
}

.btn, a {
  cursor: pointer
}

blockquote, body, code, dd, div, dl, dt, fieldset, form, h1, h2, h3, h4, h5, h6, input, legend, li, ol, p, pre, td, textarea, th, ul {
  margin: 0;
  padding: 0
}

table {
  border-collapse: collapse;
  border-spacing: 0
}

fieldset, img {
  border: 0
}

address, caption, cite, code, dfn, em, strong, th, var {
  font-style: normal;
  font-weight: 400
}

ol, ul {
  list-style: none none
}

caption, th {
  text-align: left
}

h1, h2, h3, h4, h5, h6 {
  font-size: 100%;
  font-weight: 400
}

q::after, q::before {
  content: ""
}

abbr, acronym {
  border: 0;
  font-variant: normal
}

sup {
  vertical-align: text-top
}

sub {
  vertical-align: text-bottom
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit
}

legend {
  color: #000
}

a {
  text-decoration: none
}

input {
  -webkit-appearance: none
}

* {
  -webkit-tap-highlight-color: transparent
}

html {
  background-color: #f8f8f8;
  font-family: Arial, sans-serif;
  font-size: 13px
}

@media screen and (min-width: 350px) {
  html {
    font-size: 15px
  }

  .cmt-wrap {
    font-size: 14px
  }

  .time {
    font-size: 13px
  }
}

.hide {
  display: none
}

header {
  position: relative
}

#avt, #user-name {
  position: absolute
}

#bg {
  width: 100%
}

#user-name {
  text-align: right;
  right: 114px;
  bottom: 15px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-shadow: 0 1px .5px #000
}

#share a, .btn {
  font-size: 14px
}

.btn, b {
  font-weight: 400
}

#share a, #share p, .btn {
  text-align: center
}

#avt {
  width: 74px;
  height: 74px;
  border: 1px solid #dbdbdb;
  right: 15px;
  bottom: -22px;
  padding: 1px;
  background-color: #fff
}

#list li, .po-hd, #list2 li {
  position: relative
}

#list, #list2 {
  padding: 30px 0 10px
}

#list li, #list2 li {
  line-height: 1.5;
  border-bottom: 1px solid #f0f0f0;
  margin-top: 15px;
  padding-bottom: 15px
}

#share a:nth-child(2), .ads, .po-avt {
  position: absolute
}

.ads {
  color: #999;
  right: 5px;
  top: 0
}

.ads img {
  width: 10px;
  padding-left: 8px
}

.ad-link {
  color: #3b5384
}

.post .ad-link img {
  width: 11px;
  padding: 0;
  display: inline-block
}

.po-avt-wrap {
  padding-left: 10px
}

.po-avt {
  width: 40px;
  height: 40px;
  top: 0;
  left: 10px;
  border-radius: 6px;
}

.r {
  border-bottom: 8px solid #eee;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  width: 1px;
  margin-top: 5px;
  margin-left: 10px
}

.po-cmt {
  padding-left: 60px;
  padding-right: 10px;
  width: 100%;
  box-sizing: border-box
}

.po-name {
  color: #576b95
}

.post {
  color: #252525;
  padding-bottom: 10px
}

.post img {
  padding: 10px 5px 0 0;
  display: block;
  max-height: 130px;
  max-width: 130px
}

#share a, .btn {
  display: inline-block
}

.post .list-img {
  width: 30%;
  max-height: 80px;
  max-width: 80px;
  padding-right: 5px;
  float: left;
  object-fit: cover
}

.post .list-img:last-child {
  padding-right: 0
}

.time {
  color: #b1b1b1
}

.c-icon {
  /*height: 15px;*/
  /*width: 20px;*/
  height: 18px;
  width: 18px;
  /*float: right*/
}

.cmt-wrap {
  width: 100%;
  background-color: #eee
}

.like {
  color: #576b95;
  padding: 5px 5px 3px 12px
}

.like img {
  height: 12px;
  width: 12px;
  padding-right: 5px
}

.cmt-list {
  padding: 5px 12px;
  color: #454545
}

.cmt-list p {
  padding-top: 3px
}

.cmt-list span {
  color: #3b5384
}

#share a {
  border-radius: 5px;
  background-color: #26337e;
  color: #fff;
  line-height: 2.5;
  width: 138px;
  margin: 0 10px
}

#share a:nth-child(1) {
  position: absolute;
  left: 50%;
  margin-left: -148px
}

#share a:nth-child(2) {
  right: 50%;
  margin-right: -148px
}

#share p {
  padding: 45px 0 10px;
  color: #999
}

#guide {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  /*background-image: url(../images/guide2.png);*/
  background-repeat: no-repeat;
  background-position: right top;
  background-color: #191919;
  background-size: contain;
  opacity: .9
}

.btn {
  margin-bottom: 0;
  vertical-align: middle;
  -ms-touch-action: manipulation;
  touch-action: manipulation;
  background-image: none;
  border: 1px solid transparent;
  white-space: nowrap;
  padding: 6px 12px;
  line-height: 1.42857143;
  border-radius: 4px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none
}

.btn-success {
  color: #fff;
  background-color: #5cb85c;
  border-color: #4cae4c
}

.btn-group-lg > .btn, .btn-lg {
  padding: 10px 16px;
  font-size: 18px;
  line-height: 1.3333333;
  border-radius: 6px
}

.btn-block {
  display: block;
  width: 100%
}

.bq {
  width: 13px;
  padding-left: 2px
}

.hidenone {
  display: none
}


.weui_mask_transition {
  display: none;
  position: fixed;
  z-index: 1;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0);
  -webkit-transition: background .3s;
  transition: background .3s;
}

.weui_fade_toggle {
  background: rgba(0, 0, 0, 0.6);
}

.weui_actionsheet {
  position: fixed;
  left: 0;
  bottom: 0;
  -webkit-transform: translate(0, 100%);
  -ms-transform: translate(0, 100%);
  transform: translate(0, 100%);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  z-index: 2;
  width: 100%;
  background-color: #EFEFF4;
  -webkit-transition: -webkit-transform .3s;
  transition: transform .3s;
}

.weui_actionsheet_toggle {
  -webkit-transform: translate(0, 0);
  -ms-transform: translate(0, 0);
  transform: translate(0, 0);
}

.weui_actionsheet_menu {
  background-color: #FFFFFF;
}

.weui_actionsheet_cell:before {
  content: " ";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 1px;
  border-top: 1px solid #D9D9D9;
  -webkit-transform-origin: 0 0;
  -ms-transform-origin: 0 0;
  transform-origin: 0 0;
  -webkit-transform: scaleY(0.5);
  -ms-transform: scaleY(0.5);
  transform: scaleY(0.5);
}

.weui_actionsheet_cell:first-child:before {
  display: none;
}

.weui_actionsheet_cell {
  position: relative;
  padding: 10px 0;
  text-align: center;
  font-size: 18px;
}

.weui_actionsheet_cell.title {
  color: #999;
}

.weui_actionsheet_action {
  margin-top: 6px;
  background-color: #FFFFFF;
}

</style>
